How to: Create a form with a subform.
Solution:
In Report Design view, select the 'Subform/Subreport', and follow the wizard instructions.
NOTE: Before using this procedure, make sure the table relationships are set up correctly.
1) To create a form with a subform at the same time, do the following:
a) Select the 'Insert' menu and select 'Form'. (The New Form dialog box appears.)
b) Select 'Form Wizard' from the list box.
c) Click 'OK'. (The Form Wizard dialog box appears.)
d) Select the desired table or query from the 'Tables/Queries' drop-down list box in the 'Form Wizard' dialog box.
NOTE: Use the scroll bar for more selections if necessary.
Select Table/Queries from the Form Wizard.
e) Select a field from the 'Available Fields' list box.
f) Click the '>' button. (The field name appears in the Selected Fields list box.)
g) Repeat steps 1)f) and 1)g) for the desired subform.
Select the desired field.
NOTE: The proper corresponding categories must be chosen for this function to work.
h) Click 'Next'. (The next step of the wizard appears.)
i) Select the 'Form with subform(s)' radio button.
NOTE: If the preview is incorrect, select the 'Linked forms' radio button.
j) Select the main form from the 'How do you want to view your data?' list box.
k) Click 'Next'. (The next step of the wizard appears.)
l) Select the desired radio button for the form/subform layout. (A preview of the form appears to the left of the radio buttons.)
Select the form layout.
m) Click 'Next'. (The next step of the wizard appears.)
n) Select the desired style for the form from the list box. (A preview of the style appears to the left.)
NOTE: Styles from which to choose include: Clouds, Colorful 1, Colorful 2, Dusk, Evergreen, Flax, International, Pattern, Standard, and Stone.
Select a style of the printed form.
o) Click 'Next'. (The next step of the wizard appears.)
p) Type a title for the form in the 'What title do you want for your form?' box.
NOTE: If a title is not typed, the name of the table or query used to create the form is used as the form name.
q) Do one of the following:
1] Select the 'Open the form to view or type information' radio button to view the form or type data.
2] Select the 'Modify the form's design' radio button to open the form in the Design view.
Type a form title and select radio button.
r) Click 'Finish'.
2) To create a form with a subform using existing forms, do the following:
a) If the Database window is not activated, activate the Database window.
b) Click the 'Forms' tab in the Database window.
Forms tab
c) Select the desired form from the list box. (The selected form is highlighted.)
d) Click 'Design'. (The selected form appears in Design view, and the floating Toolbox appears.)
e) Make sure the 'Control Wizard' button located in the Toolbox is depressed.
Control Wizard depressed and selected bound control
f) Press the 'F11' key on the keyboard to switch to the 'Database' window.
g) Select the desired form from the list box. (The selected form is highlighted.)
h) Drag and drop the desired form from the 'Database' window to the main form. (The subform control is added to the form.)
3) To create a subform and add it to an existing form, do the following:
a) If the Database window is not activated, activate the Database window.
b) Click the 'Forms' tab in the Database window.
Forms tab
c) Select the desired form from the list box. (The selected form is highlighted.)
d) Click 'Design'. (The selected form appears in Design view, and the floating Toolbox appears.)
e) Make sure the 'Control Wizard' button located in the Toolbox is depressed.
Control Wizard depressed and selected bound control
f) Select the 'Subform/Subreport' button on the toolbar.
g) Click where the subform is to be placed. (The Subform/Subreport Wizard appears.)
h) Do one of the following:
1] Select the 'Table/Query' radio button.
a] Click 'Next'. (The next step of the wizard appears.)
b] Select the desired fields to include on the form:
1} Select a field from the 'Available Fields' list box.
2} Click the '>' button. (The field name appears in the Selected Fields list box.)
c] Repeat steps 3)h)1]b]1} and 3)h)1]b]2} for each field to include on the form.
i) Click 'Next'. (The next step of the wizard appears.)
j) Select the desired 'Form/report fields' from the drop-down list box.
k) Select the desired 'Subform/subreport fields' from the drop-down list box.
l) Click 'Next'. (The next step of the wizard appears.)
m) Type a title for the subform in the 'What name would you like for your subform or subreport?' box.
NOTE: If a title is not typed, the name of the table or query used to create the subform is used as the subform name.